<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <style>
    ul {
      margin: 0;
      padding: 0;
      list-style: none;
    }
    li {
      width: 300px;
      /* background: skyblue; */
      border: 1px solid skyblue;
      margin: 10px 0;
      cursor: pointer;
    }
  </style>
  <body>
    <ul class="one">
      <li>1</li>
      <li>2</li>
      <li>3</li>
      <li>4</li>
      <li>5</li>
    </ul>
    -------分割线-------
    <ul class="two">
      <li>1</li>
      <li>2</li>
      <li>3</li>
      <li>4</li>
      <li>5</li>
    </ul>
  </body>
</html>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
  //   $("ul li").click(function () {
  //     console.log(this);
  //   });
  //index()获取索引
  $("li").click(function () {
    console.log($(this).index("ul li"));
  });
</script>
